home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / web / noweb / src / c / main.c < prev    next >
C/C++ Source or Header  |  1995-02-24  |  2KB  |  59 lines

  1. #line 14 "main.nw"
  2. #include <stdio.h>
  3. #include <string.h>
  4. #include <stdlib.h>
  5. #include <ctype.h>
  6. #include "notangle.h"
  7. #include "errors.h"
  8. #include "columns.h"
  9.  
  10. main(int argc, char **argv) {
  11.     int i;
  12.     char *rootname = "*";       /* name of the root module */
  13.     char *locformat = "";
  14.     char *Clocformat = "#line %L \"%F\"%N";
  15.  
  16.     tabsize = 0;  /* default for nt is not to use tabs */
  17.  
  18.     for (i=1; i<argc; i++) {
  19.         
  20. #line 40 "main.nw"
  21. if (*argv[i]=='-') {
  22.     
  23. #line 47 "main.nw"
  24.     switch (*++argv[i]) {
  25.         case 't': /* set tab size or turn off */
  26.             if (isdigit(argv[i][1]))
  27.                 tabsize = atoi(argv[i]+1);
  28.             else if (argv[i][1]==0)
  29.                 tabsize = 0;            /* no tabs */
  30.             else 
  31.                 errormsg(Error, "%s: ill-formed option %s\n", argv[0], argv[i]);
  32.             break;          
  33.         case 'R': /* change name of root module */
  34.             rootname = ++argv[i];
  35.             break;
  36.         case 'L': /* have a #line number format */
  37.             locformat = ++argv[i];
  38.             if (!*locformat) locformat = Clocformat;
  39.             break;
  40.         default:
  41.             errormsg(Warning, "Ignoring unknown option -%s", argv[i]);
  42.      }
  43. #line 42 "main.nw"
  44. } else {
  45.     
  46. #line 68 "main.nw"
  47. errormsg(Warning,
  48.     "I can't handle arguments yet, so I'll just ignore `%s'",argv[i]);
  49.  
  50. #line 44 "main.nw"
  51. }
  52. #line 32 "main.nw"
  53.     }
  54.  
  55.     notangle(stdin, stdout, rootname, locformat);
  56.     exit(errorlevel);
  57.     return errorlevel;  /* slay warning */
  58. }
  59.